<template>
  <div class="contentIndex" id="contentIndex">
    <div :class="isOpenSide ? 'side-left side-close' : 'side-left'">
      <div class="treeBox">
        <!-- <a-input-search v-model:value="searchValue" placeholder="搜索栏目名称" /> -->
        <a-input
          v-model:value="searchValue"
          placeholder="搜索栏目名称"
          allowClear
        >
          <template #suffix v-if="!searchValue.length">
            <i class="iconfont icon-search"></i>
          </template>
        </a-input>
        <div
          class="treeTitle"
          :class="
            channelId ? 'treeTitle_no_background' : 'treeTitle_background'
          "
        >
          <div @click="selectColumn" class="allColumn">所有栏目</div>
          <div>
            <div class="openorclose" @click="openorclose" v-show="!isOpen">
              <span>全部收起</span>
              <i class="iconfont icon-up" style="font-size: 24px"> </i>
            </div>
            <div class="openorclose" @click="openorclose" v-show="isOpen">
              <span>全部展开</span>
              <i class="iconfont icon-down" style="font-size: 24px"> </i>
            </div>
          </div>
        </div>
        <a-tree
          :auto-expand-parent="autoExpandParent"
          :tree-data="gData"
          :defaultExpandAll="defaultExpandAll"
          :expanded-keys="expandedKeys"
          @expand="onExpand"
          :fieldNames="fieldNames"
          class="atree"
          @select="selectColumn"
          :selectedKeys="selectedKeys"
          v-if="gData.length"
        >
          <template #title="record">
            <!-- <span>{{ record.id }}</span> -->
            <span v-if="record.channelName.indexOf(searchValue) > -1">
              {{
                record.channelName.substr(
                  0,
                  record.channelName.indexOf(searchValue)
                )
              }}
              <span style="color: #f50">{{ searchValue }}</span>
              {{
                record.channelName.substr(
                  record.channelName.indexOf(searchValue) + searchValue.length
                )
              }}
            </span>
            <span v-else>{{ record.channelName }}</span>
          </template>
        </a-tree>
      </div>
      <div
        :class="isOpenSide ? 'open-right open-right-side' : 'open-right'"
        @click="openorhideSide"
      >
        <i
          v-if="isOpenSide"
          class="iconfont icon-a-doubleright"
          style="font-size: 20px"
        >
        </i>
        <i v-else class="iconfont icon-a-doubleleft" style="font-size: 20px">
        </i>
      </div>
    </div>
    <div class="contentIndexRight">
      <div class="right-headSelect">
        <baseTabs
          @changeTabs="changeTopTabs"
          :activeKey="contentType"
          :tabsList="tabsList"
        ></baseTabs>
        <div class="button-function" v-show="contentType == 1">
          <a-button
            v-if="modelData?.length < 2 && channelId && modelData.length"
            class="addButton"
            type="primary"
            @click="addClick"
            :disabled="!modelData || !channelId"
          >
            <template #icon>
              <span class="iconfont icon-Add iconadd"></span>
            </template>
            新建
            <i
              class="iconfont icon-down"
              style="font-size: 24px; color: #ffffff; margin-left: 4px"
            />
          </a-button>
          <a-dropdown v-if="channelId || route.query.channelId">
            <a-button
              v-if="modelData?.length > 1"
              class="addButton"
              type="primary"
              :disabled="modelData == null"
            >
              <template #icon>
                <span class="iconfont icon-Add iconadd"></span>
              </template>
              新建
              <i
                class="iconfont icon-down"
                style="font-size: 24px; color: #ffffff; margin-left: 4px"
              />
            </a-button>
            <template #overlay>
              <div class="new-add-box">
                <div class="add-title">内容模型</div>
                <div class="add-list">
                  <div
                    class="add-item"
                    v-for="item in modelData"
                    @click="addRecord(item.id, item.name)"
                  >
                    <i class="iconfont icon-Add"></i>
                    <span>{{ item.name }}</span>
                  </div>
                </div>
              </div>
            </template>
          </a-dropdown>
          <div style="margin-left: 16px">
            <a-input
              @blur="searchTitle"
              @keyup.enter.native="searchTitle"
              v-model:value="params.title"
              placeholder="搜索标题或作者"
              style="width: 192px"
              allowClear
            >
              <template #suffix>
                <i @click="searchTitle" class="iconfont icon-search"></i>
              </template>
            </a-input>
          </div>
          <a-button class="open-option" @click="openMulOption">
            高级筛选
          </a-button>
          <div class="displaySwitch">
            <i
              class="iconfont icon-a-Graphiclist"
              :class="isSwith == 1 && 'swithys'"
              @click="swith(1)"
              :title="'ss'"
            ></i>
            <i
              class="iconfont icon-table"
              :class="isSwith == 2 && 'swithys'"
              @click="swith(2)"
            ></i>
          </div>
          <div style="margin-left: 16px">
            <a-select
              :disabled="!btnPerm.includes('sortAble')"
              v-model:value="params.sortType"
              style="width: 108px"
              :options="sortOptions"
              @change="onSelectType5"
            ></a-select>
          </div>
        </div>
      </div>
      <div
        class="select-content"
        v-show="isOpenSelectOption && contentType == 1"
      >
        <div class="select-item">
          <div class="title">内容状态：</div>
          <a-select
            class="title_right"
            v-model:value="params.status"
            :options="typeOptions"
            @change="onSelectType"
          ></a-select>
        </div>
        <div class="select-item">
          <div class="title">内容类型：</div>
          <a-select
            class="title_right"
            v-model:value="params.typeId"
            :options="typeData"
            @change="onSelectType3"
            :fieldNames="{
              label: 'typeName',
              value: 'id',
            }"
          ></a-select>
        </div>

        <!-- system-securityManages start -->
        <div class="select-item" v-show="!contentSecretIsOpen">
          <div class="title">内容密级：</div>
          <a-select
            class="title_right"
            v-model:value="params.secretId"
            :options="securityOptions"
            @change="onSelectType6"
          ></a-select>
        </div>
        <!-- system-securityManages end -->

        <div class="select-item">
          <a-select
            class="titleSelect title"
            v-model:value="timeType"
            :options="timeOptions"
            @change="onSelectTime"
          ></a-select>

          <date-range-picker
            class="date-content title_right"
            @change="changeTime"
            v-model:value="timeValue"
            :disabledInfo="{ type: 2, startDays: 0 }"
            :showTime="true"
            :valueFormat="valueFormat"
          ></date-range-picker>
        </div>

        <div class="select-item">
          <div class="title">内容创建方式：</div>
          <a-select
            class="title_right"
            v-model:value="params.bornType"
            :options="createOptions"
            @change="onSelectType7"
          ></a-select>
        </div>
        <div class="option-content">
          <a-button class="reset-btn" @click="resetOptions">重置</a-button>
          <div
            class="openorclose"
            @click="
              () => {
                isOpenSelectOption = false;
              }
            "
            v-show="isOpenSelectOption"
          >
            <a>收起</a>
            <i class="iconfont icon-up" style="font-size: 24px"> </i>
          </div>
        </div>
      </div>
      <div class="contBox" :class="isOpenSelectOption ? 'boxHeight' : ''">
        <div
          v-if="contentType == 1"
          class="contentIndexList"
          :class="isSwith == 1 ? 'contentTable' : ''"
          id="contentIndexList"
        >
          <contentTable
            v-if="isSwith == 1"
            :configData="configData"
            @changePage="changePage"
            @selectColumn="selectColumn"
            :contentData="contentData.records"
            :isOpen="isOpen"
            :pageSize="params.pageSize"
            :channelId="channelId"
            :pageCurrent="params.pageNum"
          >
          </contentTable>
          <contentList
            v-else
            :configData="configData"
            :channelId="channelId"
            @selectColumn="selectColumn"
            @changePage="changePage"
            :contentData="contentData.records"
            :isOpen="isOpenSelectOption"
            :pageSize="params.pageSize"
            :pageCurrent="params.pageNum"
          >
          </contentList>
        </div>
        <pigeonhole v-if="contentType == 2" :channelId="channelId"></pigeonhole>
        <!-- <timedTask v-if="contentType == 3"></timedTask> -->
        <recyclingStation
          :channelId="channelId"
          v-if="contentType == 3"
        ></recyclingStation>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import baseTabs from "@/components/tabs/baseTabs.vue";
import contentIndexList from "@/c-views/content/contentIndexList.vue";
import pigeonhole from "@/c-views/content/pigeonhole.vue";
import recyclingStation from "@/c-views/content/recyclingStation.vue";
import { Modal, message } from "ant-design-vue";
import {
  ref,
  computed,
  watch,
  reactive,
  onMounted,
  nextTick,
  createVNode,
  onActivated,
} from "vue";
import { dataSourceType, detailDataItemType, configDataType } from "@/type";
import type { TreeProps } from "ant-design-vue";
import request from "@/api/index";
import contentTable from "@/c-views/content/contentTable.vue";
import contentList from "@/c-views/content/contentList.vue";
import getters from "@/store/getters";
import dateRangePicker from "@/components/picker/dateRangePicker.vue";
import { useRoute, useRouter } from "vue-router";
import { routerPerm } from "@/utils/common";
const btnPerm = ref<any[]>([]);
// route
const route = useRoute();
const router = useRouter();
//data
const tabsList = [
  {
    tabName: "内容",
    key: 1,
  },
  {
    tabName: "归档",
    key: 2,
  },
  {
    tabName: "回收站",
    key: 3,
  },
];
//树结构数据
const fieldNames = reactive<dataSourceType>({
  title: "channelName",
  key: "id",
});

const contentType = ref(1);
const searchValue = ref<string>("");
const expandedKeys = ref<any[]>([]);
const selectedKeys = ref<any[]>([]);
const defaultExpandAll = ref<Boolean>(true);
const autoExpandParent = ref<boolean>(true);
const gData = ref<any[]>([]);
const dataList: TreeProps["treeData"] = [];
const isOpen = ref<boolean>(true); //是否展开或收起.
const siteOptions = ref<dataSourceType[]>([]);
const channelId = ref<number | string>();
const userInfo = getters.userInfo();
const isOpenSide = ref<boolean>(false);
const isOpenSelectOption = ref<boolean>(false);
const isShowIcon = ref<boolean>(false);
const contentSecretIsOpen = ref<any>("");
//内容列表
const isSwith = ref<number>(1); //图文或列表
let configData = reactive<dataSourceType>({
  total: 0,
  size: 20,
  records: [],
  current: 1,
});
const contentData = ref<dataSourceType>({});
const typeData = ref<any>([]);
//头部功能
const sortOptions = ref<dataSourceType>([]);
const modelData = ref<dataSourceType>([]);
const valueFormat = ref("YYYY-MM-DD HH:mm:ss");
const securityOptions = ref<(string | number)[]>([]);
const timeValue = ref<(string | number)[]>([]);
const timeType = ref<string | number>(1);
const typeOptions = [
  { label: "全部", value: null },
  { label: "草稿", value: 1 },
  { label: "审核中", value: 3 },
  { label: "待发布", value: 4 },
  { label: "已发布", value: 5 },
  { label: "审核不通过", value: 6 },
  { label: "已下线", value: 7 },
  { label: "归档", value: 8 },
];
const timeOptions = [
  { label: "创建时间", value: 1 },
  { label: "发布时间", value: 2 },
];
let params: dataSourceType = ref({
  //头部筛选请求参数格式
  bornType: null,
  channelId: channelId.value || route.query?.channelId || null,
  createTimeEnd: null,
  createTimeStart: null,
  // extend: {},
  pageNum: 1,
  pageSize: 20,
  publishTimeEnd: null,
  publishTimeStart: null,
  secretId: null,
  sortType: null,
  status: null,
  title: null,
  typeId: null,
});

const createOptions = [
  { label: "全部", value: null },
  { label: "后台创建", value: 1 },
  { label: "前台投稿", value: 2 },
  { label: "站群推送", value: 3 },
  { label: "站群采集", value: 4 },
  { label: "外部采集", value: 8 },
];

//method

///头部右侧按钮功能
// 根据栏目ID加载内容模板对应的模型列表
const fetchChannelModelList = async () => {
  if (!route.query?.channelId && !channelId.value) {
    return;
  }
  let params = {
    channelId: channelId.value || route.query?.channelId,
  };
  let data = await request.fetchChannelModelList(params);
  nextTick(() => {
    modelData.value = data;
  });
};

//新增的提示
const addClick = async () => {
  if (!modelData.value) {
    message.warning("内容模型不能为空，请前往设置！");
  }
  if(channelId.value) {
    router.push({
    path: "/content/newContent",
    query: {
      id: modelData.value[0].id,
      channelId: channelId.value,
      modelName: modelData.value[0].name,
    },
  });
  }
};

// 新增
const addRecord = (id: any, modelName: any) => {
  if(channelId.value) {
    router.push({
    path: "/content/newContent",
    query: {
      id: id,
      channelId: channelId.value,
      modelName: modelName,
    },
  });
  }
};

//搜索
const searchTitle = () => {
  fetchContentPage();
};

// 搜索-排序方式选择
const onSelectType5 = () => {
  fetchContentPage();
};

// 搜索-内容状态选择
const onSelectType = () => {
  fetchContentPage();
};

// 搜索-内容类型选择
const onSelectType3 = () => {
  fetchContentPage();
};

// 搜索-内容密集选择
/*system-securityManages start*/
const onSelectType6 = () => {
  fetchContentPage();
};
/*system-securityManages end*/

// 搜索-内容创建方式选择
const onSelectType7 = () => {
  fetchContentPage();
};

//选择创建时间
const onSelectTime = () => {
  timeValue.value = [];
  if (timeType.value == 1) {
    params.value.publishTimeStart = null;
    params.value.publishTimeEnd = null;
  } else {
    params.value.createTimeEnd = null;
    params.value.createTimeStart = null;
  }
};

// 筛选时间
const changeTime = (data: any) => {
  if (data) {
    if (timeType.value == 1) {
      params.value.createTimeStart = data[0];
      params.value.createTimeEnd = data[1];
    } else {
      params.value.publishTimeStart = data[0];
      params.value.publishTimeEnd = data[1];
    }
  } else {
    if (timeType.value == 1) {
      params.value.createTimeStart = null;
      params.value.createTimeEnd = null;
    } else {
      params.value.publishTimeStart = null;
      params.value.publishTimeEnd = null;
    }
  }
  fetchContentPage();
};
const getcontentSecret = async () => {
  contentSecretIsOpen.value = await request.getcontentSecret();
};

// 切换图文、列表//切换
const swith = (num: number) => {
  isSwith.value = num;
};

//打开高级筛选
const openMulOption = () => {
  isOpenSelectOption.value = !isOpenSelectOption.value;
};

// 内容排序搜索
const fetchContentSortTypes = async (datas: dataSourceType = {}) => {
  const data = await request.fetchContentSortTypes();
  var arr = [];
  for (var i in data) {
    if (i != "0") {
      arr.push({ value: i, label: data[i] });
    }
  }
  sortOptions.value = [{ label: "默认排序", value: null }, ...arr];
};
/*system-securityManages start*/
const fetchUserSecretNameList = async (datas: dataSourceType = {}) => {
  const data = await request.fetchUserSecretNameList({ secretType: 1 });
  nextTick(() => {
    data.forEach((item: any) => {
      item.label = item.name;
      item.value = item.id;
    });
    securityOptions.value = [{ label: "全部", value: null }, ...data];
  });
};
/*system-securityManages end*/
// 重置
const resetOptions = () => {
  timeType.value = 1;
  timeValue.value = [];
  params.value = {
    //头部筛选请求参数格式
    bornType: null,
    channelId: null,
    createTimeEnd: null,
    createTimeStart: null,
    // extend: {},
    pageNum: 1,
    pageSize: 20,
    publishTimeEnd: null,
    publishTimeStart: null,
    secretId: null,
    sortType: null,
    status: null,
    title: null,
    typeId: null,
  };
  fetchContentPage();
};

///内容列表相关
// 更新列表
const changePage = async (data: any) => {
  params.value.pageNum = data.pageCurrent || 1;
  params.value.pageSize = data.pageSize || 20;
  fetchContentPage();
};

// 内容列表分页
const fetchContentPage = async () => {
  const data = await request.fetchContentPage(params.value);
  configData.total = data.data.total;
  configData.size = data.data.size;
  configData.current = data.data.current;
  configData.records = data.data.records.map((item: dataSourceType) => {
    return Object.assign(item, {
      checked: false,
      offlineTime: item?.offlineTime || "一",
    });
  });
};

// 内容类型
const fetchContentTypePageList = async () => {
  contentData.value = await request.fetchContentTypePageList();
  typeData.value = [
    { typeName: "全部", id: null },
    ...contentData.value.records,
  ];
};

//改变头部tab切换
const changeTopTabs = (activeKey: number) => {
  contentType.value = activeKey;
};
//获取栏目层级树列表
const fetchChannelListBySiteId = async () => {
  let params = {
    allPermFilter: true,
    siteId: userInfo.siteId,
  };
  if (route.query?.channelId) {
    selectedKeys.value = [+route.query.channelId];
    defaultExpandAll.value = true;
  }
  let data = await request.contentColumnTree({});
  nextTick(() => {
    gData.value = data;
    dataList.push(...data);
    getExpandKeyFunc();
  });
};
const onExpand = (keys: string[]) => {
  expandedKeys.value = keys;
  autoExpandParent.value = false;
};
watch(searchValue, (value) => {
  parentKey.value = [];
  if (value) {
    dataList.map((item: any) => {
      getParentKey(value, item);
    });
  }
  expandedKeys.value = parentKey.value;
  searchValue.value = value;
  autoExpandParent.value = true;
});
watch(selectedKeys, (value) => {
  parentKey.value = [];
  if (value) {
    dataList.map((item: any) => {
      getParentKeys(value, item);
    });
  }
  expandedKeys.value = parentKey.value;
  autoExpandParent.value = true;
});
// watch(router.currentRoute.value.query, (newVal, oldVal) => {
//   if (newVal) {
//     console.log(newVal, 'newVal.channelId')
//     //channelId.value = +newVal.channelId;
//   }
// }, { deep: true, immediate: true })

const getParentKeys = (value: any, node: any) => {
  if (value[0] == node.id) {
    // parentKey = node.id;
    parentKey.value.push(node.id);
    if (node.children) {
      node.children.map((item: any) => {
        getParentKeys(value[0], item);
      });
    }
  } else {
    if (node.children) {
      node.children.map((item: any) => {
        getParentKeys(value, item);
      });
    }
  }
};
const parentKey = ref<(string | number)[]>([]);
const getParentKey = (value: string | number, node: any) => {
  if (node.channelName.indexOf(value) > -1) {
    // parentKey = node.id;
    parentKey.value.push(node.id);
    if (node.children) {
      node.children.map((item: any) => {
        getParentKey(value, item);
      });
    }
  } else {
    if (node.children) {
      node.children.map((item: any) => {
        getParentKey(value, item);
      });
    }
  }
};

const selectColumn = (item: any) => {
  params.value.pageNum = 1;
  params.value.pageSize = 20;
  if (item) {
    channelId.value = item[0];
    params.value.channelId = item[0];
    selectedKeys.value = [item[0]];
  } else {
    channelId.value = undefined;
    params.value.channelId = undefined;
    selectedKeys.value = [];
  }

  fetchContentPage();
  fetchChannelModelList();
};
const openorclose = () => {
  isOpen.value = !isOpen.value;
  if (isOpen.value) {
    expandedKeys.value = [];
  } else {
    traversal(dataList);
    console.log(dataList);
  }
};
const traversal = (data: any) => {
  data.map((item: any) => {
    parentKey.value.push(item.id);
    if (item.children) {
      traversal(item.children);
    }
  });
  expandedKeys.value = parentKey.value;
};
//展开收起侧边栏
const openorhideSide = () => {
  isOpenSide.value = !isOpenSide.value;
};

// //侧边栏鼠标移入事件
// const mouseenter = () => {
//   isShowIcon.value = true;
// };

// //侧边栏鼠标移出事件
// const mouseleave = () => {
//   isShowIcon.value = isOpenSide.value ? true : false;
// };

const getExpandKeyFunc = () => {
  if (route.query.channelId) getParLoopKeys(gData.value, route.query.channelId);
  function getParLoopKeys(arr: any, id: any) {
    arr?.length &&
      arr.forEach((item: any) => {
        if (item.id == id) {
          expandedKeys.value.push(id);
          // if (item?.parentId) {
          //   expandedKeys.value.push(item.parentId)
          // }
        } else if (item?.children && item?.children.length) {
          getParLoopKeys(item.children, id);
        }
      });
  }
};

//onmounted
onMounted(async () => {
  btnPerm.value = routerPerm();
  fetchChannelListBySiteId();
  fetchChannelModelList();
  fetchContentPage();
  fetchContentTypePageList();
  fetchContentSortTypes();
  getcontentSecret();
  /*system-securityManages start*/
  fetchUserSecretNameList();
  /*system-securityManages end*/
});
//onActivated
onActivated(() => {
  fetchContentPage();
  fetchChannelListBySiteId();
});
</script>

<style lang="less" scoped>
.contentIndex {
  // background: #fff;
  // padding-bottom: 24px;
  height: calc(100% - 72px);
  display: flex;
  background-color: #fff;
  padding: 16px 16px 20px 16px;

  .icon-search {
    color: rgba(0, 0, 0, 0.45);
    font-size: 20px !important;
    line-height: 20px;
  }

  .side-left {
    width: 200px;
    max-height: calc(100% - 24px);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    padding-right: 4px;
    position: relative;
    transition: width 0.3s;
    padding-right: 16px;

    .treeBox {
      height: 100%;
      width: 184px;
    }

    .treeTitle {
      margin-top: 16px;
      margin-bottom: 4px;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 24px;
      border-radius: 2px;
      padding: 0 4px;
      margin-left: 24px;
      cursor: pointer;

      .allColumn {
        color: rgba(0, 0, 0, 0.85);
      }

      .iconfont {
        line-height: 24px;
        margin-left: 4px;
        color: rgba(0, 0, 0, 0.85);
      }

      .openorclose {
        cursor: pointer;
        display: flex;
        align-items: center;
      }
    }

    .openorclose:hover {
      color: #1f6ded;

      .iconfont {
        color: #1f6ded;
      }
    }

    .treeTitle:active {
      color: #1f6ded;

      .iconfont {
        color: #1f6ded;
      }
    }

    .treeTitle_no_background {
      background-color: transparent;
    }

    .treeTitle:hover {
      background-color: #f5f5f5;
    }

    .treeTitle_background {
      background-color: #edf7ff;

      &:hover {
        background-color: #edf7ff;
      }
    }

    ::v-deep(.ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected) {
      background-color: #edf7ff;
    }

    .open-right {
      position: absolute;
      top: 50%;
      right: -1px;
      margin-top: -15px;
      bottom: -20px;
      height: 30px;
      width: 20px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: center;
      background: #ffffff;
      border: 1px solid rgba(0, 0, 0, 0.06);
      z-index: 2;
    }

    .open-right-side {
      right: -4px;
    }

    .iconfont:hover {
      color: rgba(0, 0, 0, 0.6);
    }

    .iconfont {
      color: rgba(0, 0, 0, 0.45);
    }
  }

  .right-headSelect {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin: 0 16px;

    ::v-deep(
        .ant-tabs-top > .ant-tabs-nav::before,
        .ant-tabs-bottom > .ant-tabs-nav::before,
        .ant-tabs-top > div > .ant-tabs-nav::before,
        .ant-tabs-bottom > div > .ant-tabs-nav::before
      ) {
      border: none;
    }

    .button-function {
      height: 32px;
      display: flex;
      flex-direction: row;
      align-items: center;

      .addButton {
        display: flex;
        align-items: center;
        width: 108px;
        height: 32px;
        border-radius: 2px;

        .iconadd {
          font-size: 24px;
          margin-right: 4px;
        }
      }

      .open-option {
        margin-left: 8px;
      }

      .open-option:hover {
        border-color: #4892fa;
        color: #4892fa;
      }

      .open-option:active {
        border-color: #1050c7;
        color: #1050c7;
      }
    }

    .displaySwitch {
      margin-left: 16px;
      line-height: 20px;

      i {
        padding: 6px 8px;
        font-size: 20px;
        line-height: 20px;
        border: 1px solid #d9d9d9;
        color: rgba(0, 0, 0, 0.65);
        cursor: pointer;
      }

      i:first-child {
        border-radius: 2px 0px 0px 2px;
      }

      i:last-child {
        border-radius: 0px 2px 2px 0px;
      }

      .swithys {
        color: #1f6ded;
        background: #edf7ff;
        border: 1px solid #1f6ded;
      }
    }

    .importButton {
      margin-right: 8px;
    }
  }

  .select-content {
    background: rgba(0, 0, 0, 0.02);
    display: flex;
    margin: 16px 16px 4px 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 0 16px 16px;
    position: relative;

    .select-item {
      margin-right: 16px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-end;
      margin-top: 16px;

      .title {
        font-size: 14px;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        width: 104px;
        margin-right: 12px;
        color: rgba(0, 0, 0, 0.85);
        text-align: right;
      }

      .title_right {
        flex: 1;
      }
    }

    .option-content {
      flex: 1;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-end;
      height: 32px;
      margin-top: 16px;
      margin-right: 16px;
      position: sticky;
      right: 16px;

      .reset-btn {
        height: 32px;
      }

      .reset-btn:hover {
        border-color: #4892fa;
        color: #4892fa;
      }

      .reset-btn:active {
        border-color: #1050c7;
        color: #1050c7;
      }

      .openorclose {
        display: flex;
        flex-direction: row;
        align-items: center;
        margin-left: 16px;
        font-size: 14px;
        font-family: PingFang SC-Regular, PingFang SC;
        font-weight: 400;
        color: #1f6ded;

        .iconfont {
          margin-left: 4px;
        }
      }
    }
  }

  .side-close {
    width: 0;
    border: none;
    transition: width 0.3s;

    .treeBox {
      display: none;
    }
  }
}

.contentIndexList {
  background-color: #fff;
  width: 100%;
  height: 100%;
  flex: 1;
  flex-direction: column;
}

.contentTable {
  overflow: auto;
}

.contentIndexLeft {
  padding-right: 24px;
  width: 216px;
  height: 100%;
}

.contentIndexRight {
  flex: 1;
  width: 0; // 不要删除，不然flex:1不生效
  // display: flex;
  // flex-direction: column;

  .ant-tabs {
    padding-right: 16px;
    // height: 20px;
    background-color: #fff;
  }

  .contBox {
    position: relative;
    height: calc(100% - 40px);
  }

  .boxHeight {
    height: calc(100% - 200px);
  }
}

.new-add-box {
  background: #ffffff;
  box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05),
    0px 6px 16px 0px rgba(0, 0, 0, 0.08), 0px 3px 6px -4px rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  padding: 20px;

  .add-title {
    font-size: 14px;
    line-height: 14px;
    display: block;
    color: #000000d9;
  }

  .add-list {
    margin-top: 16px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;

    .add-item {
      margin-right: 8px;
      padding: 3px 12px;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      border-radius: 2px;
      border: 1px solid rgba(0, 0, 0, 0.15);

      .icon-Add {
        display: block;
        line-height: 24px;
        font-size: 24px;
        color: #000000d9;
      }

      span {
        font-size: 14px;
        color: #000000d9;
      }
    }

    .add-item:hover {
      cursor: pointer;
    }

    .add-item:hover {
      border-color: #1f6dedff;

      .icon-Add {
        color: #1f6dedff;
      }

      span {
        color: #1f6dedff;
      }
    }

    .add-item:active {
      border-color: #1050c7ff;

      .icon-Add {
        color: #1050c7ff;
      }

      span {
        color: #1050c7ff;
      }
    }
  }
}

::v-deep(.ant-tabs-tab + .ant-tabs-tab) {
  margin: 0 0 0 24px;
}

::v-deep(.ant-tabs-tab) {
  padding: 8px 0;
}

::v-deep(::-webkit-scrollbar) {
  height: 10px;
}

::v-deep(.side-left .ant-tree-list-holder) {
  width: auto;
  height: 100%;
  transition: width 0.3s;
}

::v-deep(.side-close .ant-tree-list-holder) {
  width: 0;
  height: 100%;
  transition: width 0.3s;
}

::v-deep(.side-left .ant-tree-list:hover .ant-tree-list-scrollbar) {
  display: block !important;
}

::v-deep(.ant-tree-list .ant-tree-list-scrollbar) {
  display: none !important;
}

::v-deep(.ant-tree-list-scrollbar-thumb) {
  background: rgba(0, 0, 0, 0.15) !important;
}

::v-deep(.ant-checkbox + span) {
  padding-left: 12px;
  padding-right: 0;
}

::v-deep(.ant-table-wrapper) {
  margin-top: 0px;
}

::v-deep(.ant-table-thead > tr > th) {
  // padding: 16px 0 16px 16px;
}
</style>
<style lang="less">
.side-left {
  .ant-tree {
    height: calc(100% - 88px);
    overflow: auto;

    .ant-tree-treenode {
      width: 100%;

      .ant-tree-node-content-wrapper {
        width: 100%;
      }
    }

    .ant-tree::-webkit-scrollbar {
      display: none;
    }

    .ant-tree:hover::-webkit-scrollbar {
      display: block;
    }

    .ant-tree-list-scrollbar-thumb {
      height: auto !important;
    }

    .ant-tree-list-holder {
      overflow-y: unset !important;
    }
  }
}

@media screen and (min-width: 1800px) {
  .select-content {
    .select-item {
      width: calc(32.99999% - 12px);
    }

    .select-item:nth-of-type(3) {
      margin-right: 0;
    }
  }
}

@media screen and (max-width: 1780px) {
  .select-content {
    .select-item {
      width: calc(50% - 16px);
    }

    .select-item:nth-of-type(2n) {
      margin-right: 0;
    }
  }
}
</style>
